﻿using System;
using System.Text;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Xml;

namespace AMS.Web
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class SaveMessage : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {

            context.Response.ContentEncoding = Encoding.UTF8;  
            context.Response.ContentType = "text/plain";
            if (context.Request.Params["txtValue"] != null)
            {
                string strQueryString = context.Request.Params["txtValue"].Trim();

                string xmlFilePath = AppDomain.CurrentDomain.BaseDirectory + "BackStageManagement/Count.xml"; //XML文件路径

                var xmlObj = new XmlDocument();

                xmlObj.Load(xmlFilePath);

                XmlNode xmlTotalOjb = xmlObj.SelectSingleNode("Count/Message");

                xmlTotalOjb.InnerText = strQueryString;
                xmlObj.Save(xmlFilePath);
                context.Response.Write("Ok");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
